package miku.firstgame.net.pack
{
	import flash.utils.ByteArray;

	import miku.firstgame.constrants.ProtocalConstants;
	import miku.firstgame.net.ByteArrayEx;

	public class GetReadyRequestPack extends AbstractRequestPack
	{
		public var isReady:Boolean;

		public function GetReadyRequestPack()
		{
			super();
		}

		override public function encode():ByteArray
		{
			var data:ByteArrayEx = new ByteArrayEx();
			data.writeUnsignedInt(5);
			data.writeShort(tag);
			data.writeShort(0);
			if (isReady)
			{
				data.writeByte(0);
			}
			else
			{
				data.writeByte(1);
			}
			data.position = 0;
			return data;
		}

		override public function get tag():int
		{
			return ProtocalConstants.GET_READY;
		}
	}
}
